-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add Median/p50, p90, p99 to python profiler #15953
Conversation
end_time = time.perf_counter() # 2 | ||
run_time = end_time - start_time # 3 | ||
runs = args[1] | ||
modified_args = (args[0], 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so Im trying to reuse the existing code.
Other function uses runs and runs a for loop here
I reuse the above function. MXNet profiler is able to log the data on a per run basis without explicitly storing that info after every run/iteration
But we need to do that. So that's what I am doing it here
Not sure if this is the best way. But I wanted to reuse the code and ensure it is backward compatible. Hence this workaround.
Let me know if I should clarify further.
Thanks for the contribution. How to enable the percentile output for users? Or it comes as default? |
Comes as default if chosen profiler as python |
unused var remove add parameter missing arg add mean, median, p90,p99 to markdown markdown
bb3e9fc
to
d226c38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
end_time = time.perf_counter() # 2 | ||
run_time = end_time - start_time # 3 | ||
runs = args[1] | ||
modified_args = (args[0], 1, args[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example case what are now sent in modified_args ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently when you run opperf
args are - [op, runs, args]
runs is the # of times we want to run this operator
For python profiler to work, we need to call the operator explicitly those many times
Hence runs = args[1] stores the number of times user wanted to run the operator
Now, the alias takes the argument to run MXNet profiler on it
We're overwriting on that, hence we pass run=1 to MXNet profiler
modified args = [op, 1, args]
Does that answer your question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we decide which profiler to call (selects which decorator to use 'cpp' or 'python'
The reason why I had to modify the args, was because I wanted to reuse the function
Here it runs the operator runs number of times. But I can't add python time functions here as it will change the behavior of the function for python as well as cpp decorator. Hence I had to override the function by modifying the arguments passed.
@mxnet-label-bot add [pr-awaiting-review] |
Description
Profile more metrics (than just average; also fix incorrect avg calculation)
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.